<?php

	function sc_dump(){
		print_r('ROOT:'.ROOT.'<br />');
		print_r('APP_CORE_PATH:'.APP_CORE_PATH.'<br />');
		print_r('SC_CORE_PATH:'.SC_CORE_PATH.'<br />');
		print_r('VIEW_EXT:'.VIEW_EXT.'<br />');
	}

	define('ROOT', dirname(__FILE__));
	define('DS', DIRECTORY_SEPARATOR);
	$index = strrpos($_SERVER['PHP_SELF'], '/');
	$replace = array('<', '>', '*', '\'', '"');
	define(WEBROOT, str_replace($replace, '', substr($_SERVER['PHP_SELF'], 0, $index + 1)));

	if(!file_exists(ROOT.DS.'shortcake.cnf')){
		exit('shortcake.cnfが見つかりません。');
	}
	require_once ROOT.DS.'shortcake.cnf';

	if(!file_exists(SC_CORE_PATH.'bootstrap.php')){
		exit('shortcake/bootstrap.phpが見つかりません。');
	}
	require_once SC_CORE_PATH.'bootstrap.php';

	$Dispatcher = new Dispatcher();
	try{
		$Dispatcher->dispatch();
	}
	catch (MissingControllerException $e){
		print $e->getMessage();
	}
	catch(UrlParseException $e){
		print $e->getMessage();
	}
	catch (ObjectOfControllerNotFoundException $e){
		print $e->getMessage();
	}

/*
	require CORE_PATH . 'cake' . DS . 'basics.php';
	$TIME_START = getMicrotime();
	require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
	require LIBS . 'object.php';
	require LIBS . 'inflector.php';
	require LIBS . 'configure.php';

	$bootstrap = true;
	$url = null;
	require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
*/
?>